#include "inc/os.h"
#include "inc/user_api.h"

#define DELAY 2000

void user_task0(void)
{
	uint32_t mstatus;
	mstatus = get_mstatus();
	printf("syscall mstatus = %d\n", mstatus);

	// illegal instructions
	mstatus = r_mstatus();

	uart_puts("Would not go here!");
}

void user_task1(void)
{
        uart_puts("Task 1: Created!\n");
        while (1) {
                uart_puts("Task 1: Running...\n");
                task_delay(DELAY);
        }
}

/* NOTICE: DON'T LOOP INFINITELY IN main() */
void os_main(void)
{
        task_create(user_task0);
        task_create(user_task1);
}
